#pragma once
#include "InternalsPlugin.hpp"
#include "Sprite.hpp"
#include "TypeDefs.hpp"

class WidgetSessionStatus
{
public:
	WidgetSessionStatus(const char *pRootPath, const char *pIniUIFilename, const char *pIniDriverMappingFilename, const char *pIniVehiculeClassMappingFilename);
	~WidgetSessionStatus(void);

	void init(const ScreenInfoV01 &info, float ratio, float ratioWidth, float ratioHeight, Sprite spriteList[]);
	void updateData(bool isRace, const ScoringInfoV01 &info, DriverInfo & viewedDriverInfo, DriverInfo orderedDriverInfos[]);
	void render(int profileIndex, const ScreenInfoV01 &info, bool isRace, const LPD3DXFONT *fontList, const D3DCOLOR *colorList, Sprite spriteList[], DriverInfo orderedDriverInfos[]); 

	bool isLapSessionLimit(const ScoringInfoV01 &info, DriverInfo & di);
	std::string WidgetSessionStatus::getTimeAsString(double seconds, bool forceAllFields, bool padHighest, bool showMillis, bool showFullMillis);

//private:
  bool initialized;
 
  	int nbProfiles;
	PluginProfile profiles[10];

	RECT tmpRect;
	
 const char *rootPath;
  char iniUIFilename[800];

  bool isLapLimit; // true if the session limit is based on lap
  float lastLapSwitchDisplay;
  bool lastLapDisplayed;

  // widget
  bool available;
  ImageData bgImageData;

    // tools
  char tmp[1000];

  // info
  bool infoAvailable;
  TextData infoTextData;
  char infoStr[20];

  	////////////////////////////////////////////////////
	// S1 
	////////////////////////////////////////////////////
    int s1FlagToDisplay; // 0=none, 1=yellow, 2=finish
	// S1 No Flag
    bool s1NoFlagAvailable;
    ImageData s1NoFlagImageData;
	// S1 Yellow Flag
    bool s1YellowFlagAvailable;
    ImageData s1YellowFlagImageData;
	// S1 Finish Flag
    bool s1FinishFlagAvailable;
    ImageData s1FinishFlagImageData;
  	////////////////////////////////////////////////////
	// S2 
	////////////////////////////////////////////////////
    int s2FlagToDisplay; // 0=none, 1=yellow, 2=finish
	// S2 No Flag
    bool s2NoFlagAvailable;
    ImageData s2NoFlagImageData;
	// S2 Yellow Flag
    bool s2YellowFlagAvailable;
    ImageData s2YellowFlagImageData;
	// S2 Finish Flag
    bool s2FinishFlagAvailable;
    ImageData s2FinishFlagImageData;

  	////////////////////////////////////////////////////
	// S3
	////////////////////////////////////////////////////
    int s3FlagToDisplay; // 0=none, 1=yellow, 2=finish
	// S3 No Flag
    bool s3NoFlagAvailable;
    ImageData s3NoFlagImageData;
	// S3 Yellow Flag
    bool s3YellowFlagAvailable;
    ImageData s3YellowFlagImageData;
	// S3 Finish Flag
    bool s3FinishFlagAvailable;
    ImageData s3FinishFlagImageData;

	/////////////////////////////////////////////////////
	// Start Lights
	/////////////////////////////////////////////////////
	int lightToDisplay; // 0=off, 1=red, 2=green
	// No light
    bool lightOffAvailable;
    ImageData lightOffImageData;
	// Red light
    bool lightRedAvailable;
    ImageData lightRedImageData;
	// Green light
    bool lightGreenAvailable;
    ImageData lightGreenImageData;

};

